using System;
using Castle.Components.Validator;

namespace SimplePMT.Components.ActiveRecordExtensions
{
	public class ValidateNullOrMaxAttribute : AbstractValidationAttribute
	{
		private IValidator _validator;
		public ValidateNullOrMaxAttribute(int maxLength, string errorMessage)
			: base(errorMessage)
		{
			this._validator = new NullOrMaxValidator(maxLength);
		}
		public override IValidator Build()
		{
			base.ConfigureValidatorMessage(this._validator);
			return this._validator;
		}
	}
}
